import React from "react";
import { Product } from "../interface";

interface ProductRowProps {
  product: Product;
}
/**
 * (黄色)展示每个产品的行
 * @props ProductRowProps
 * @returns 函数组件
 */
const ProductRow: React.FC<ProductRowProps> = ({ product }) => {
  const name = product.stocked ? product.name : <span style={{ color: "red" }}>{product.name}</span>;

  return (
    <tr>
      <td>{name}</td>
      <td>{product.price}</td>
    </tr>
  );
};
export default ProductRow;
